/*************************************************************************
	> File Name: 1.375C.cpp
	> Author: hug
	> Mail: hug@haizeix.com
	> Created Time: 日  2/ 9 10:06:21 2025
 ************************************************************************/

#include <iostream>
using namespace std;

int n;
char A[3005][3005], B[3005][3005];

void  change(int &x, int &y) {
    int dx = y, dy = n - x + 1;
    x = dx, y = dy;
    return ;
}

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        scanf("%s", A[i] + 1);
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            int k = min(i, n - i + 1);
            k =  min(k, min(j, n - j + 1));
            k %= 4;
            int x = i, y = j;
            while (k--) change(x, y);
            B[x][y] = A[i][j];
        }
    }
    for (int i = 1; i <= n; i++) {
        printf("%s\n", B[i] + 1);
    }
    return 0;
}
